package com.ruoyi.electricity.mapper;


import com.ruoyi.electricity.domain.ElectricityData;
import com.ruoyi.electricity.domain.ElectricityMeterData;
import com.ruoyi.electricity.domain.TRiskWarnings;
import com.ruoyi.electricity.domain.vo.GisEquipVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.util.Date;
import java.util.List;

/**
 * 用电Mapper接口
 *
 * @author ljw
 * @date 2023-08-29
 */
@Mapper
public interface ElectricityDataMapper
{
    void deleteElectricityData();

    void updateElectricityHistoryData();


    void updateThresholdsForNormalAndAlarmAndWarn(ElectricityData electricityData);

    void insertElectricityDataToHistoryTable(@Param("electricityDataList") List<ElectricityData> electricityDataList);

    void insertElectricityDataToDayTable(@Param("electricityDataList") List<ElectricityData> electricityDataList);

    List<ElectricityData> selectElectricityDataThatNeedToSendAlarm();

    void insertElectricityAlarm(@Param("electricityDataList") List<ElectricityData> electricityDataList);

    void updateElectricityAlarmStatusAsSent(@Param("electricityData") ElectricityData electricityData);

    void mergeElectricityDataListToTable(@Param("electricityDataList") List<ElectricityData> electricityDataList);

    void deleteElectricityDataNotInList(@Param("electricityDataList") List<ElectricityData> electricityDataList);
    /**
     * 查询用电
     *
     * @param id 用电主键
     * @return 用电
     */
    public ElectricityData selectElectricityDataById(String id);

    /**
     * 查询用电列表
     *
     * @param electricityData 用电
     * @return 用电集合
     */
    public List<ElectricityData> selectElectricityDataList(ElectricityData electricityData);

    /**
     * 新增用电
     *
     * @param electricityData 用电
     * @return 结果
     */
    public int insertElectricityData(ElectricityData electricityData);

    /**
     * 修改用电
     *
     * @param electricityData 用电
     * @return 结果
     */
    public int updateElectricityData(ElectricityData electricityData);

    /**
     * 删除用电
     *
     * @param id 用电主键
     * @return 结果
     */
    public int deleteElectricityDataById(String id);

    /**
     * 批量删除用电
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteElectricityDataByIds(String[] ids);

    List<ElectricityData> selectElectricityHistoryDataList(@Param("electricityData") ElectricityData electricityData, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<TRiskWarnings> selectElectricityAlarmList(@Param("riskWarnings") TRiskWarnings riskWarnings, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    void editElectricityAlarmHandle(TRiskWarnings riskWarnings);

    List<GisEquipVo> selectAllGisEquips(GisEquipVo gisEquipVo);

    List<GisEquipVo> selectGisEquipsHasCoordinates();

    void updateGisEquipsCoordinates(GisEquipVo gisEquipVo);
    void updateAlarmSentFlagAsNotSent(String equipName);

    void deleteElectricityDataToDayTable();

    List<ElectricityMeterData> selectElectricityDataTodayList();

}
